package com.ai.notices.web.controller.busi;

import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.ai.notices.web.system.AppBaseController;
import com.ai.notices.web.system.util.StaffSessionUtil;

@Controller
public class SystemController extends AppBaseController{

	public static final String secretKey = "54C1432142982598170EBA2649540281";
	
	@RequestMapping(value="/404")
    public String handle(Model  model) {
        return "redirect:/error";
    }
	
	@RequestMapping(value="/error")
    public String error(Model  model) {
        return "/busi/error/404";
    }
	
	/**
	 * 退出系统
	 * @param model
	 * @return
	 */
	@RequestMapping(value = "/system/logout")
	public String logout(Model model){
		
		StaffSessionUtil.removeStaffInfo(session);
		
		return "redirect:/login";
	}
	
	/**
	 * ajax请求是session 超时处理
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/system/sessionOut")
	public String sessionOut(HttpServletResponse response){
		response.setStatus(401);
		return "busi/sys/sessionout";
	}
	
	/**
	 * 无访问权限跳转界面
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/system/noAuth")
	public String noAuth(HttpServletResponse response){
		return "busi/sys/noauth";
	}

}